<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/11
 * Time: 15:08
 */

namespace app\admin\controller;


use app\common\controller\AdminBaseController;
use app\common\ext\IDb;
use app\common\ext\IRequest;

class UserLoan extends AdminBaseController{
    /**
     * @功能 获取用户贷款信息列表
     * @开发者 yy
     */
    public function user_loan_list(){
        //接受参数
        $user_id = IRequest::get('user_id');
        $loan_type = IRequest::get('loan_type');

        //获取数据
        $where = null;
        if(!empty($user_id)) $where['user_id'] = $user_id;
        if(!empty($loan_type)) $where['loan_type'] = $loan_type;
        $user_loan_list = IDb::getInstance('asset_loan')->setDbWhere($where)->setDbOrder('user_loan_id desc')->pag();

        //页面赋值
        $this->assign('user_id', $user_id);
        $this->assign('loan_type', $loan_type);
        $this->assign('user_loan_list', $user_loan_list);

        //页面显示
        return view();

    }

    /**
     * @功能 获取用户贷款信息
     * @开发者 yy
     */
    public function user_loan_info(){
        //接受参数
        $user_loan_id = IRequest::get('user_loan_id', IRequest::NOT_EMPTY, '贷款编号不能为空');

        //获取详情信息
        $where = null;
        $where['user_loan_id'] = $user_loan_id;
        $user_loan_info = IDb::getInstance('asset_loan')->setDbWhere($where)->row();

        //设置layout
        $this->layout("layout_empty");

        //页面赋值
        $this->assign('user_loan_info', $user_loan_info);

        return view();


    }


}